home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 04 - 1988 / 04.04 Apr 88 / TearOffPalette Source / Interface.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-02-10  |  2.1 KB  |  89 lines  |  [TEXT/KAHL]

  1. /*
  2. ----------------------------------------------------------------------------------------------------
  3. T E A R O F F   P A L E T T E
  4.  
  5.     version 1.0
  6.     by Don Melton and Mike Ritter
  7.     
  8.     Copyright (C)1987, 1988 by Impulse Technologies, Inc., all rights reserved. 
  9.     
  10.     Filename:            Interface.c
  11.     Font:                    Monaco, 9 point
  12.     Tab setting:    2
  13.     Compiler:            LightspeedC 2.15, Project type: APPL, Creator: TOPD
  14.     Segment:            Main */
  15.  
  16.  
  17.  
  18. /*
  19. ----------------------------------------------------------------------------------------------------
  20. GLOBAL CONSTANT DEFINITIONS AND VARIABLE DECLARATIONS */
  21.  
  22. #include "Constants.h"
  23. #include "Variables.h"
  24.  
  25. /*
  26. ----------------------------------------------------------------------------------------------------
  27. EXTERNAL FUNCTION DECLARATIONS */
  28.  
  29. /* None */
  30.  
  31. /*
  32. ----------------------------------------------------------------------------------------------------
  33. FORWARD FUNCTION DECLARATIONS */
  34.  
  35. void AdjustInterface();
  36. short GetMenuBarHeight();
  37.  
  38.  
  39.  
  40. /*
  41. ----------------------------------------------------------------------------------------------------
  42. ADJUST INTERFACE */
  43.  
  44. void AdjustInterface() {
  45.  
  46.     if(Environment.hasColorQD) {
  47.         MaxDevice = GetMaxDevice(&(*GrayRgn)->rgnBBox);
  48.         
  49.         if((*(*MaxDevice)->gdPMap)->pixelSize == 8) {
  50.         
  51.             if(!ColorMenuVisible) {
  52.                 /* Insert the Color menu if the screen is capable of displaying 256 colors. */
  53.                 InsertMenu(Menus[COLOR_MENU_INDEX], 0);
  54.                 DrawMenuBar();
  55.                 ColorMenuVisible = true;
  56.             }
  57.         }
  58.         else {
  59.         
  60.             if(ColorMenuVisible) {
  61.                 /* Remove the Color menu if the screen cannot display 256 colors. */
  62.                 DeleteMenu(COLOR_MENU_ID);
  63.                 DrawMenuBar();
  64.                 ColorMenuVisible = false;
  65.                 
  66.                 if(((WindowPeek) Palettes[COLOR_PALETTE])->visible) {
  67.                     HideWindow(Palettes[COLOR_PALETTE]);
  68.                 }
  69.                 PalettesVisible[COLOR_PALETTE] = false;
  70.             }
  71.         }
  72.     }
  73. }
  74.  
  75. /*
  76. ----------------------------------------------------------------------------------------------------
  77. GET MENU BAR HEIGHT */
  78.  
  79. short GetMenuBarHeight() {
  80.  
  81.     if(Environment.machineType < envMachUnknown) {
  82.         /* Arrggh! Someone has the 64K ROMs. */
  83.         return(20);
  84.     }
  85.     else {
  86.         return(MBarHeight);
  87.     }
  88. }
  89.